package com.wj1c.push.wechat.request;

import com.wj1c.push.wechat.request.base.AbstractRequest;
import com.wj1c.push.wechat.request.base.RequestMethod;
import com.wj1c.push.wechat.request.model.base.Template;
import com.wj1c.push.wechat.request.model.base.TemplateModel;
import com.wj1c.push.wechat.response.TemplateMsgResponse;

/**
 * @author: Mr.Jiao
 * @date: 2018年09月04日
 */
public class TemplateMsgRequest extends AbstractRequest<TemplateMsgResponse> {

    public TemplateMsgRequest(String accesstoken) {
        super(String.format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=%s",accesstoken));
    }

    @Override
    public RequestMethod getMethod() {
        return RequestMethod.POST;
    }

    @Override
    public Class<TemplateMsgResponse> getResponseClass() {
        return TemplateMsgResponse.class;
    }

    public void setTouser(String touser){
        super.set("touser", touser);
    }

    public void setTemplateId(Template template){
        super.set("template_id", template.getValue());
    }

    public void setDate(TemplateModel data){
        super.set("data", data.getData());
    }

    @Override
    public void setAppidAndSecret(String appid, String secret) {
    }
}
